/*
  * Copyright (c) 2025 Huawei Device Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
    *
  * http://www.apache.org/licenses/LICENSE-2.0
    *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * */

// automatically generated by the FlatBuffers compiler, do not modify

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */

import * as flatbuffers from '@ohos/flatbuffers';



export class BasicScalars {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):BasicScalars {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsBasicScalars(bb:flatbuffers.ByteBuffer, obj?:BasicScalars):BasicScalars {
  return (obj || new BasicScalars()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsBasicScalars(bb:flatbuffers.ByteBuffer, obj?:BasicScalars):BasicScalars {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new BasicScalars()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

int8():number {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
}

int16():number {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}

int32():number {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}

int64():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}

uint8():number {
  const offset = this.bb!.__offset(this.bb_pos, 12);
  return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
}

uint16():number {
  const offset = this.bb!.__offset(this.bb_pos, 14);
  return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
}

uint32():number {
  const offset = this.bb!.__offset(this.bb_pos, 16);
  return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
}

uint64():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 18);
  return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}

float32():number {
  const offset = this.bb!.__offset(this.bb_pos, 20);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

float64():number {
  const offset = this.bb!.__offset(this.bb_pos, 22);
  return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
}

bool():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 24);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

static startBasicScalars(builder:flatbuffers.Builder) {
  builder.startObject(11);
}

static addInt8(builder:flatbuffers.Builder, int8:number) {
  builder.addFieldInt8(0, int8, 0);
}

static addInt16(builder:flatbuffers.Builder, int16:number) {
  builder.addFieldInt16(1, int16, 0);
}

static addInt32(builder:flatbuffers.Builder, int32:number) {
  builder.addFieldInt32(2, int32, 0);
}

static addInt64(builder:flatbuffers.Builder, int64:bigint) {
  builder.addFieldInt64(3, int64, BigInt('0'));
}

static addUint8(builder:flatbuffers.Builder, uint8:number) {
  builder.addFieldInt8(4, uint8, 0);
}

static addUint16(builder:flatbuffers.Builder, uint16:number) {
  builder.addFieldInt16(5, uint16, 0);
}

static addUint32(builder:flatbuffers.Builder, uint32:number) {
  builder.addFieldInt32(6, uint32, 0);
}

static addUint64(builder:flatbuffers.Builder, uint64:bigint) {
  builder.addFieldInt64(7, uint64, BigInt('0'));
}

static addFloat32(builder:flatbuffers.Builder, float32:number) {
  builder.addFieldFloat32(8, float32, 0.0);
}

static addFloat64(builder:flatbuffers.Builder, float64:number) {
  builder.addFieldFloat64(9, float64, 0.0);
}

static addBool(builder:flatbuffers.Builder, bool:boolean) {
  builder.addFieldInt8(10, +bool, +false);
}

static endBasicScalars(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static finishBasicScalarsBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
  builder.finish(offset);
}

static finishSizePrefixedBasicScalarsBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
  builder.finish(offset, undefined, true);
}

static createBasicScalars(builder:flatbuffers.Builder, int8:number, int16:number, int32:number, int64:bigint, uint8:number, uint16:number, uint32:number, uint64:bigint, float32:number, float64:number, bool:boolean):flatbuffers.Offset {
  BasicScalars.startBasicScalars(builder);
  BasicScalars.addInt8(builder, int8);
  BasicScalars.addInt16(builder, int16);
  BasicScalars.addInt32(builder, int32);
  BasicScalars.addInt64(builder, int64);
  BasicScalars.addUint8(builder, uint8);
  BasicScalars.addUint16(builder, uint16);
  BasicScalars.addUint32(builder, uint32);
  BasicScalars.addUint64(builder, uint64);
  BasicScalars.addFloat32(builder, float32);
  BasicScalars.addFloat64(builder, float64);
  BasicScalars.addBool(builder, bool);
  return BasicScalars.endBasicScalars(builder);
}
}
